<!DOCTYPE html>
<html lang="zh-CN" ng-app="share">

	<head>
		<meta charset='utf-8' />
		
		<!--<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>-->
		<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.6/angular.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.6/angular-sanitize.min.js"></script>
		<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
		<script src="/static/js/my.js"></script>
		<bootstrap></bootstrap>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		</head>
		<body >
			{% block content %}
	<script type="text/javascript">

		app.controller('content',function ($scope) {
			$scope.view='mainpage';
			$scope.mainpage='heyulin';
			$scope.jiemu='<div>这里是节目文字html</div>';
			$scope.zhan_number=0;
			$scope.btn_txt='给节目点赞';
			$scope.can_dian_zhan=true;
			$scope.msg='';
			$scope.enter_jiemu=function (jiemu) {
				
				$http.get('getjson')
				.success(function(data, status, headers, config) {  
				    //加载成功之后做一些事  
				    $scope.view='jiemu';
				    $scope.jiemu=data.jiemu;
				    $scope.zhan_number=data.number;
				    $scope.zhan_text='已经有'+data.number+'个赞';
				    
				}).error(function(data, status, headers, config) {  
				    //处理错误  
				});  
				
			};
			$scope.return_main=function () {
				
				$scope.view='mainpage';
			};
			$scope.dian_zhan=function(jiemu){
				$scope.zhan_number+=1;
				$scope.can_dian_zhan=false;
				$scope.btn_txt='你已经点击过了';

				var postData = {
					operation:'dian_zhan'
				};  
				$http.post('postjson/',postData)
				.success(function(data, status, headers, config) {  
				    //加载成功之后做一些事  
				    //$scope.view='jiemu';
				    $scope.jiemu=data.jiemu;
				    //$scope.zhan_number=data.number;
				    $scope.zhan_text='已经有'+data.number+'个赞';
				    
				}).error(function(data, status, headers, config) {  
				    //处理错误 
				    $scope.msg='有错误,返回码为:',
				    $scope.msg+=status; 
				});  
			}
		})
		</script>
		<div ng-controller='content'>
			<div>
				<h1>这里是节目单，列表</h1>
				{% for i in jiemu_list %}
				<div><a href="jiemu/{{i.jiemu_id}}">{{i.title}}</a></div>
				
				{% endfor %}
			</div>
		</div>
		<!--<div ng-switch='view'>
			<div ng-switch-when='mainpage'>
				<div ng-bind='mainpage'></div>
				<button name="enter_jiemu" type="button" value="val" ng-click='enter_jiemu()'>进入测试节目</button>
			</div>

			<div ng-switch-when='jiemu'>
				<p ng-bind-html="jiemu"></p>
				<div ng-bind='zhan_text'></div>
				<button name="zhan" type="button" value="val" ng-bind='btn_txt' ng-click='dian_zhan()' ng-disabled='!can_dian_zhan' class="btn btn-default"></button>
				<button name="return_main" type="button" value="val" ng-click='return_main()'>返回节目菜单</button>
			</div>
			
		</div>-->
		{% endblock %}

		</body>
		</html>